#ifndef __LAUNCHER_H__
#define __LAUNCHER_H__

#pragma once

#include "NezhaEngine.h"

namespace Nezha
{

	class MiniFramework;

	class MiniFrameworkCreator
	{
	public:
		virtual MiniFramework* create() = 0;
	};

	class MiniFramework
	{
	public:
		virtual ~MiniFramework(){}

		virtual void initialSetConfig(EngineConfig* cfg) = 0;

		virtual bool initialize() = 0;

		virtual bool externalUpdate() = 0;

		virtual void uninitialize() = 0;

		static void SetFramework(const char* name);

		static void RegisterFrameworkCreator(const char* name, MiniFrameworkCreator* c);

		static MiniFramework* msMiniFramework;
	private:
		static PMap<_string, MiniFrameworkCreator*> msCreators;
	};

	template <typename T>
	class MiniFrameworkCreatorAutoRegister : public MiniFrameworkCreator
	{
	public:
		MiniFrameworkCreatorAutoRegister(const char* name)
		{
			MiniFramework::RegisterFrameworkCreator(name, this);
		}

		MiniFramework* create()
		{
			return NZ_New T;
		}
	};

}


#endif //end __LAUNCHER_H__